#
# Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: X11
#

#Create the project in the output directory
set_part xcvc1902-vsva2197-2MP-e-S

#Set the board part
set_property board_part xilinx.com:vck190:part0:3.2 [current_project]

#####Read all sources for building the project#####
#Read the RTL files that has XPM NMUs and NSUs instantiated along with traffic generators and BRAM 
read_verilog {{../sources/rtl/rm2/pl_master_to_ddr_low0.v} {../sources/rtl/rm2/pl_master_to_ddr_low1.v} {../sources/rtl/rm2/pl_master2_to_ddr_low1.v} {../sources/rtl/rm2/RP1.v}}

#Generate the XCI files for BRAMs, Performance Traffic Generators and VIO IPs
source ../sources/ip/rm2/axis_vio_pl_master_to_ddr.tcl
source ../sources/ip/rm2/perf_axi_tg_pl_master_to_ddr_low0.tcl
source ../sources/ip/rm2/perf_axi_tg_pl_master_to_ddr_low1.tcl
source ../sources/ip/rm2/perf_axi_tg_pl_master2_to_ddr_low1.tcl
source ../sources/ip/rm2/axi_dbg_hub_0.tcl

#Set the addressing parameter on debug hub IP
set_property CONFIG.C_ADDR_OFFSET {0x20400000000} [get_ips axi_dbg_hub_0]
set_property CONFIG.C_ADDR_RANGE {0x200000} [get_ips axi_dbg_hub_0]

#Read the XDC files for creating NoC connection, setting its QoS settings and the aperture of XPM NSUs. 
read_xdc ../sources/xdc/rm2/noc_constraints.xdc

#Read the XDC files that has constraints for creating ILAs and for connecting them to debug hub in the design. This constraint is auto-generated by the tool based on "Set up Debug" flow.
read_xdc ../sources/xdc/rm2/rm2_debug.xdc

#####Set the USED_IN {synthesis_pre} for NoC constraints#####
set_property USED_IN {synthesis_pre} [get_files ../sources/xdc/rm2/noc_constraints.xdc]

#####Generate all targets : XCI/BD######

synth_ip [get_ips { axis_vio_pl_master_to_ddr perf_axi_tg_pl_master_to_ddr_low0 perf_axi_tg_pl_master_to_ddr_low1 perf_axi_tg_pl_master2_to_ddr_low1 axi_dbg_hub_0} ]

##Updating the sourcefile set 
set_property source_mgmt_mode All [current_project]
update_compile_order


#Validate_noc happens in synth_design call. User can also call it explicitly 
synth_design -top RP1 -part xcvc1902-vsva2197-2MP-e-S -mode out_of_context
write_checkpoint -force outputs/dcps/rm2_synth.dcp

exit
